{extend name="layout:base" /}{/block}
{block name="content"}
<div class="col-1">
    <div class="content" style="position:relative; overflow:hidden">
        <div class="location">
            <p><a href="javascript:history.back(-1);" class="a01">返回</a>您的当前位置：<a href="#">数据管理</a><span>&gt;</span><a href="#">景区景点</a><span>&gt;</span>列表查询</p>
        </div>

        <div class="main">
            <div class="main_head">
                    <div class="fl">
                        <form action="" method="get">
                        <input name="sex" type="text" class="input01" value="" placeholder="请输入性别">
                        <!--<input type="hidden" name="page_size" id="page_size" value=""/>-->
                        <input name="" type="submit" class="button01" value="搜索">
                        </form>
                    </div>
                    <div class="fr">
                        <a href="{:url('Admin/add')}" class="button01" style="text-align: center">添加</a>
                        <input name="" type="button" class="button02" id="del_more" value="删除">
                    </div>

            </div>

            <div class="main_list">
                <table width="100%" border="1" class="table_center">
                    <tr class="bg">
                        <td><input name="" type="checkbox" class="input_check" onclick="checkAll(this)" value=""></td>
                        <td>编号</td>
                        <td>性别</td>
                        <td>真实姓名</td>
                        <td>别名</td>
                        <td>创建时间</td>
                        <td>最后登录时间</td>
                        <td>最后登录ip</td>
                        <td>登录次数</td>
                        <td>头像</td>
                        <td>角色</td>
                        <td>邮箱</td>
                        <td>是否锁定</td>
                        <td>操作</td>
                    </tr>
                    {volist name='lists' id='vo'}
                    <tr>
                        <td nowrap><input type="checkbox" name="ids" value="{$vo.id}"></td>
                        <td nowrap>{$vo.id}</td>
                        <td nowrap>{$vo.sex}</td>
                        <td nowrap>{$vo.logname}</td>
                        <td nowrap>{$vo.uname}</td>
                        <td nowrap><?php echo date('Y-m-d H:i:s',$vo['ctime'])?></td>
                        <td nowrap><?php echo date('Y-m-d H:i:s',$vo['lastlog'])?></td>
                        <td nowrap>{$vo.lastip}</td>
                        <td nowrap>{$vo.logcnt}</td>
                        <td nowrap><img src="{$vo.head}" width="100px"></td>
                        <td nowrap>{$vo.role_name}</td>
                        <td nowrap>{$vo.email}</td>
                        <td nowrap><input type="checkbox" id="checkbox_c{$vo.id}" class="chk" {if condition="$vo.locking eq 1" }checked{/if}/><label for="checkbox_c{$vo.id}"></label></td>
                        <td nowrap>
                            <a href="{:url('Admin/detail',['id'=>$vo.id])}">详情</a>
                            <a href="/admin/admin/set?id={$vo.id}">设置</a>
                            <a href="{:url('Admin/edit',['id'=>$vo.id])}" class="a01">编辑</a>
                            <a href="javascript:void(0);" onclick="del(this)" pid="{$vo.id}" class="a02">删除</a>
                        </td>
                    </tr>
                    {/volist}

                </table>
            </div>
            <div class="fl" style="width:30%;">
                <select name="" class="" style="height:32px;margin-top: 10px;" id="operates">
                    <option value="">批量操作</option>
                    <option value="DEL">删除</option>
                    <option value="VALID">锁定</option>
                    <option value="UNVALID">解锁</option>
                </select>
                <button class="button03" style="text-align: center;margin-top: 10px;" onclick="operate_more();">确定</button>
            </div>
            <div class="fr02" style="line-height:40px;">
                {$lists->render()}
                <!--<select name="" class="set_page_size" style="margin-top:-4px;height:32px;">-->
                    <!--<option value="5">5条</option>-->
                    <!--<option value="10">10条</option>-->
                    <!--<option value="15">15条</option>-->
                    <!--<option value="20">20条</option>-->
                <!--</select>-->
                <span class="pagerTotle">检索到{$lists->total()}条记录，共{$lists->lastPage()}页&nbsp;&nbsp;</span>
                <br class="clean" />
            </div>
        </div>

    </div>
</div>


{/block}
{block name="js"}
<script type="text/javascript">
    // 批量操作
    function operate_more(){
        var operate = $("#operates").val();
        var url,data_value,data_name,extra_data,confirm_msg;
        // 获取选中数据
        var id = [];
        var ids = $("input[name='ids']:checked");
        $(ids).each(function(){
            id.push($(this).val());
        });
        data_value = id;
        data_name = "id=";
        if(operate){
            if(operate=='DEL'){
                url = "{:url('Admin/del')}";
                confirm_msg = "确认删除选中项吗?";
                extra_data = '';
            }else if(operate=='VALID'){
                extra_data = '&locking=1';
                url = "{:url('Admin/setValid')}";
                confirm_msg = "确认设置选中项为锁定用户吗?";
            }else if(operate=='UNVALID'){
                extra_data = '&locking=0';
                url = "{:url('Admin/setValid')}";
                confirm_msg = "确认设置为选中项解锁吗?";
            }
            if(confirm(confirm_msg)){
                $.ajax({
                    'type':'post',
                    'url' :url,
                    'data':data_name+data_value+extra_data,
                    success: function(response){
                        alert(response.msg);
                        document.location.reload();
                    }
                });
            }
        }
    }
    function del(e){
        var id = $(e).attr('pid');
        if(confirm("确认删除吗？")){
            $.ajax({
                'type':'post',
                'url' :"{:url('Admin/del')}",
                'data':"id="+id,
                success: function(response){
                    console.debug(response);
                    alert(response.msg);
                    document.location.reload();
                }
            });
        }
    }

</script>
{/block}
